<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>RobotClient: ConnectionDlg.cpp源文件</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">RobotClient
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- 制作者 Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="namespaces.html"><span>命名空间</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>文件成员</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_connection_dlg_8cpp.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">ConnectionDlg.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_connection_dlg_8cpp.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// *** ADDED BY HEADER FIXUP ***</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include &lt;wx/utils.h&gt;</span>
<a name="l00003"></a>00003 <span class="comment">// *** END ***</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;<a class="code" href="_connection_dlg_8h.html">ConnectionDlg.h</a>&quot;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;wx/xml/xml.h&gt;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;wx/sstream.h&gt;</span>
<a name="l00007"></a>00007 <span class="comment">//(*InternalHeaders(ConnectionDlg)</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;wx/intl.h&gt;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;wx/string.h&gt;</span>
<a name="l00010"></a>00010 <span class="comment">//*)</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;wx/msgdlg.h&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;wx/textfile.h&gt;</span>
<a name="l00013"></a>00013 <span class="comment">//(*IdInit(ConnectionDlg)</span>
<a name="l00014"></a>00014 <span class="keyword">const</span> <span class="keywordtype">long</span> <a class="code" href="class_connection_dlg.html#a96625de9db7930153643d952d4243dfe">ConnectionDlg::ID_STATICTEXT3</a> = wxNewId();
<a name="l00015"></a>00015 <span class="keyword">const</span> <span class="keywordtype">long</span> <a class="code" href="class_connection_dlg.html#a45c0c438f5b4300fa9eeb5079872e8eb">ConnectionDlg::ID_TEXTCTRL3</a> = wxNewId();
<a name="l00016"></a>00016 <span class="keyword">const</span> <span class="keywordtype">long</span> <a class="code" href="class_connection_dlg.html#a974ab14c1ce539dbe5ec5412649cb286">ConnectionDlg::ID_STATICTEXT1</a> = wxNewId();
<a name="l00017"></a>00017 <span class="keyword">const</span> <span class="keywordtype">long</span> <a class="code" href="class_connection_dlg.html#a07becf336d2137ec158326c76cda57d6">ConnectionDlg::ID_TEXTCTRL1</a> = wxNewId();
<a name="l00018"></a>00018 <span class="keyword">const</span> <span class="keywordtype">long</span> <a class="code" href="class_connection_dlg.html#ad80300ec654b38cacb42478e92b4a0ca">ConnectionDlg::ID_STATICTEXT2</a> = wxNewId();
<a name="l00019"></a>00019 <span class="keyword">const</span> <span class="keywordtype">long</span> <a class="code" href="class_connection_dlg.html#a4e4a37e44af0bcdf2424c0d69382f541">ConnectionDlg::ID_TEXTCTRL2</a> = wxNewId();
<a name="l00020"></a>00020 <span class="keyword">const</span> <span class="keywordtype">long</span> <a class="code" href="class_connection_dlg.html#a63d732468822c3ab84a448aca28978a3">ConnectionDlg::ID_BUTTON1</a> = wxNewId();
<a name="l00021"></a>00021 <span class="comment">//*)</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 BEGIN_EVENT_TABLE(<a class="code" href="class_connection_dlg.html">ConnectionDlg</a>,wxDialog)
<a name="l00024"></a>00024         <span class="comment">//(*EventTable(ConnectionDlg)</span>
<a name="l00025"></a>00025         <span class="comment">//*)</span>
<a name="l00026"></a>00026 END_EVENT_TABLE()
<a name="l00027"></a>00027 
<a name="l00028"></a><a class="code" href="class_connection_dlg.html#acb9731f6811bd1b28afa9b174a403b7f">00028</a> <a class="code" href="class_connection_dlg.html">ConnectionDlg</a>::<a class="code" href="class_connection_dlg.html">ConnectionDlg</a>(wxWindow* parent,wxWindowID <span class="keywordtype">id</span>,const wxPoint&amp; pos,const wxSize&amp; size)
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030         BuildContent(parent,<span class="keywordtype">id</span>,pos,size);
<a name="l00031"></a>00031 }
<a name="l00032"></a>00032 
<a name="l00033"></a><a class="code" href="class_connection_dlg.html#ab75aa0c1e4487827fb60af707ebccecf">00033</a> <span class="keywordtype">void</span> <a class="code" href="class_connection_dlg.html#ab75aa0c1e4487827fb60af707ebccecf">ConnectionDlg::BuildContent</a>(wxWindow* parent,wxWindowID <span class="keywordtype">id</span>,<span class="keyword">const</span> wxPoint&amp; pos,<span class="keyword">const</span> wxSize&amp; size)
<a name="l00034"></a>00034 {
<a name="l00035"></a>00035         <span class="comment">//(*Initialize(ConnectionDlg)</span>
<a name="l00036"></a>00036         wxBoxSizer* BoxSizer1;
<a name="l00037"></a>00037 
<a name="l00038"></a>00038         Create(parent, <span class="keywordtype">id</span>, _(<span class="stringliteral">&quot;服务器连接&quot;</span>), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxCLOSE_BOX|wxDIALOG_NO_PARENT, _T(<span class="stringliteral">&quot;id&quot;</span>));
<a name="l00039"></a>00039         SetClientSize(wxDefaultSize);
<a name="l00040"></a>00040         Move(wxDefaultPosition);
<a name="l00041"></a>00041         BoxSizer1 = <span class="keyword">new</span> wxBoxSizer(wxHORIZONTAL);
<a name="l00042"></a>00042         <a class="code" href="class_connection_dlg.html#a4ceb35f51a88b0e6b5d573f2c11fff7d">StaticText3</a> = <span class="keyword">new</span> wxStaticText(<span class="keyword">this</span>, <a class="code" href="class_connection_dlg.html#a96625de9db7930153643d952d4243dfe">ID_STATICTEXT3</a>, _(<span class="stringliteral">&quot;你的名字:&quot;</span>), wxDefaultPosition, wxDefaultSize, 0, _T(<span class="stringliteral">&quot;ID_STATICTEXT3&quot;</span>));
<a name="l00043"></a>00043         BoxSizer1-&gt;Add(<a class="code" href="class_connection_dlg.html#a4ceb35f51a88b0e6b5d573f2c11fff7d">StaticText3</a>, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
<a name="l00044"></a>00044         <a class="code" href="class_connection_dlg.html#a6ad9689a6f85e83dcf86a70b45cf7e04">txName</a> = <span class="keyword">new</span> wxTextCtrl(<span class="keyword">this</span>, <a class="code" href="class_connection_dlg.html#a45c0c438f5b4300fa9eeb5079872e8eb">ID_TEXTCTRL3</a>, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER, wxDefaultValidator, _T(<span class="stringliteral">&quot;ID_TEXTCTRL3&quot;</span>));
<a name="l00045"></a>00045         BoxSizer1-&gt;Add(<a class="code" href="class_connection_dlg.html#a6ad9689a6f85e83dcf86a70b45cf7e04">txName</a>, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
<a name="l00046"></a>00046         <a class="code" href="class_connection_dlg.html#afcae0ab7639173cc0b31f967e3442438">StaticText1</a> = <span class="keyword">new</span> wxStaticText(<span class="keyword">this</span>, <a class="code" href="class_connection_dlg.html#a974ab14c1ce539dbe5ec5412649cb286">ID_STATICTEXT1</a>, _(<span class="stringliteral">&quot;服务器地址:&quot;</span>), wxDefaultPosition, wxDefaultSize, 0, _T(<span class="stringliteral">&quot;ID_STATICTEXT1&quot;</span>));
<a name="l00047"></a>00047         BoxSizer1-&gt;Add(<a class="code" href="class_connection_dlg.html#afcae0ab7639173cc0b31f967e3442438">StaticText1</a>, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
<a name="l00048"></a>00048         <a class="code" href="class_connection_dlg.html#a6135d99604b45174a183df717239d695">txAddr</a> = <span class="keyword">new</span> wxTextCtrl(<span class="keyword">this</span>, <a class="code" href="class_connection_dlg.html#a07becf336d2137ec158326c76cda57d6">ID_TEXTCTRL1</a>, _(<span class="stringliteral">&quot;127.0.0.1&quot;</span>), wxDefaultPosition, wxSize(97,22), wxTE_PROCESS_ENTER, wxDefaultValidator, _T(<span class="stringliteral">&quot;ID_TEXTCTRL1&quot;</span>));
<a name="l00049"></a>00049         BoxSizer1-&gt;Add(<a class="code" href="class_connection_dlg.html#a6135d99604b45174a183df717239d695">txAddr</a>, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
<a name="l00050"></a>00050         <a class="code" href="class_connection_dlg.html#a19f3d095d80a5aea63510b1350148a76">StaticText2</a> = <span class="keyword">new</span> wxStaticText(<span class="keyword">this</span>, <a class="code" href="class_connection_dlg.html#ad80300ec654b38cacb42478e92b4a0ca">ID_STATICTEXT2</a>, _(<span class="stringliteral">&quot;端口:&quot;</span>), wxDefaultPosition, wxDefaultSize, 0, _T(<span class="stringliteral">&quot;ID_STATICTEXT2&quot;</span>));
<a name="l00051"></a>00051         BoxSizer1-&gt;Add(<a class="code" href="class_connection_dlg.html#a19f3d095d80a5aea63510b1350148a76">StaticText2</a>, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
<a name="l00052"></a>00052         <a class="code" href="class_connection_dlg.html#ac2be4dcc2088374d3a6adc59dd702a1d">txPort</a> = <span class="keyword">new</span> wxTextCtrl(<span class="keyword">this</span>, <a class="code" href="class_connection_dlg.html#a4e4a37e44af0bcdf2424c0d69382f541">ID_TEXTCTRL2</a>, _(<span class="stringliteral">&quot;9800&quot;</span>), wxDefaultPosition, wxSize(46,22), wxTE_PROCESS_ENTER, wxDefaultValidator, _T(<span class="stringliteral">&quot;ID_TEXTCTRL2&quot;</span>));
<a name="l00053"></a>00053         BoxSizer1-&gt;Add(<a class="code" href="class_connection_dlg.html#ac2be4dcc2088374d3a6adc59dd702a1d">txPort</a>, 0, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
<a name="l00054"></a>00054         <a class="code" href="class_connection_dlg.html#a08c6de3d69fdbaf85dcde22336e75c99">bnConnect</a> = <span class="keyword">new</span> wxButton(<span class="keyword">this</span>, <a class="code" href="class_connection_dlg.html#a63d732468822c3ab84a448aca28978a3">ID_BUTTON1</a>, _(<span class="stringliteral">&quot;连接&quot;</span>), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(<span class="stringliteral">&quot;ID_BUTTON1&quot;</span>));
<a name="l00055"></a>00055         BoxSizer1-&gt;Add(<a class="code" href="class_connection_dlg.html#a08c6de3d69fdbaf85dcde22336e75c99">bnConnect</a>, 0, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
<a name="l00056"></a>00056         SetSizer(BoxSizer1);
<a name="l00057"></a>00057         BoxSizer1-&gt;Fit(<span class="keyword">this</span>);
<a name="l00058"></a>00058         BoxSizer1-&gt;SetSizeHints(<span class="keyword">this</span>);
<a name="l00059"></a>00059         Center();
<a name="l00060"></a>00060 
<a name="l00061"></a>00061         Connect(<a class="code" href="class_connection_dlg.html#a45c0c438f5b4300fa9eeb5079872e8eb">ID_TEXTCTRL3</a>,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&amp;<a class="code" href="class_connection_dlg.html#a18228e18d6f5283b1fd42b3d55f0bb3d">ConnectionDlg::OnbnConnectClick</a>);
<a name="l00062"></a>00062         Connect(<a class="code" href="class_connection_dlg.html#a07becf336d2137ec158326c76cda57d6">ID_TEXTCTRL1</a>,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&amp;ConnectionDlg::OnbnConnectClick);
<a name="l00063"></a>00063         Connect(<a class="code" href="class_connection_dlg.html#a4e4a37e44af0bcdf2424c0d69382f541">ID_TEXTCTRL2</a>,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&amp;ConnectionDlg::OnbnConnectClick);
<a name="l00064"></a>00064         Connect(<a class="code" href="class_connection_dlg.html#a63d732468822c3ab84a448aca28978a3">ID_BUTTON1</a>,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&amp;ConnectionDlg::OnbnConnectClick);
<a name="l00065"></a>00065         <span class="comment">//*)</span>
<a name="l00066"></a>00066         <a class="code" href="class_connection_dlg.html#a87d30c0aef06fc85f41d93fd60dff6f3">LoadSetting</a>();
<a name="l00067"></a>00067 }
<a name="l00068"></a>00068 
<a name="l00069"></a><a class="code" href="class_connection_dlg.html#af80e08a9c4f719787af56796acb1f62c">00069</a> <a class="code" href="class_connection_dlg.html#af80e08a9c4f719787af56796acb1f62c">ConnectionDlg::~ConnectionDlg</a>()
<a name="l00070"></a>00070 {
<a name="l00071"></a>00071         <span class="comment">//(*Destroy(ConnectionDlg)</span>
<a name="l00072"></a>00072         <span class="comment">//*)</span>
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074 
<a name="l00075"></a><a class="code" href="class_connection_dlg.html#af2352027e0c26e29122285f6474c1197">00075</a> wxSocketBase* <a class="code" href="class_connection_dlg.html#af2352027e0c26e29122285f6474c1197">ConnectionDlg::GetConnection</a>(wxWindow *parent)
<a name="l00076"></a>00076 {
<a name="l00077"></a>00077     SetParent(parent);
<a name="l00078"></a>00078     <span class="keywordflow">if</span>(ShowModal()==<a class="code" href="_connection_dlg_8h.html#a1924df58d74539017dc6ac2daaf18dd6">EXIT_LEGAL</a>)
<a name="l00079"></a>00079         <span class="keywordflow">return</span> <a class="code" href="class_connection_dlg.html#a258d3cc15ec391945598f3255346758b">sock</a>;
<a name="l00080"></a>00080     <span class="keywordflow">else</span> <span class="keywordflow">return</span> NULL;
<a name="l00081"></a>00081 }
<a name="l00082"></a>00082 
<a name="l00083"></a>00083 
<a name="l00084"></a><a class="code" href="class_connection_dlg.html#a18228e18d6f5283b1fd42b3d55f0bb3d">00084</a> <span class="keywordtype">void</span> <a class="code" href="class_connection_dlg.html#a18228e18d6f5283b1fd42b3d55f0bb3d">ConnectionDlg::OnbnConnectClick</a>(wxCommandEvent&amp; event)
<a name="l00085"></a>00085 {
<a name="l00086"></a>00086         <span class="keywordflow">if</span>(<a class="code" href="class_connection_dlg.html#a6ad9689a6f85e83dcf86a70b45cf7e04">txName</a>-&gt;GetValue().IsEmpty())
<a name="l00087"></a>00087         {
<a name="l00088"></a>00088                 wxMessageBox(_(<span class="stringliteral">&quot;名字不能为空!!&quot;</span>));
<a name="l00089"></a>00089                 <span class="keywordflow">return</span>;
<a name="l00090"></a>00090         }
<a name="l00091"></a>00091         wxIPV4address addr;
<a name="l00092"></a>00092         addr.Hostname(<a class="code" href="class_connection_dlg.html#a6135d99604b45174a183df717239d695">txAddr</a>-&gt;GetValue());
<a name="l00093"></a>00093         addr.Service(<a class="code" href="class_connection_dlg.html#ac2be4dcc2088374d3a6adc59dd702a1d">txPort</a>-&gt;GetValue());
<a name="l00094"></a>00094         <a class="code" href="class_connection_dlg.html#a258d3cc15ec391945598f3255346758b">sock</a> = <span class="keyword">new</span> wxSocketClient();
<a name="l00095"></a>00095         <a class="code" href="class_connection_dlg.html#a258d3cc15ec391945598f3255346758b">sock</a>-&gt;Connect(addr,<span class="keyword">false</span>);
<a name="l00096"></a>00096         <a class="code" href="class_connection_dlg.html#a258d3cc15ec391945598f3255346758b">sock</a>-&gt;WaitOnConnect(5);
<a name="l00097"></a>00097         <span class="keywordflow">if</span>(!<a class="code" href="class_connection_dlg.html#a258d3cc15ec391945598f3255346758b">sock</a>-&gt;IsConnected())
<a name="l00098"></a>00098         {
<a name="l00099"></a>00099                 <a class="code" href="class_connection_dlg.html#a258d3cc15ec391945598f3255346758b">sock</a>-&gt;Destroy();
<a name="l00100"></a>00100                 wxMessageBox(_(<span class="stringliteral">&quot;连接服务器失败！！&quot;</span>));
<a name="l00101"></a>00101         }
<a name="l00102"></a>00102         <span class="keywordflow">else</span>
<a name="l00103"></a>00103         {
<a name="l00104"></a>00104             wxString msg = _(<span class="stringliteral">&quot;&lt;Login&gt;&quot;</span>)+<a class="code" href="class_connection_dlg.html#a6ad9689a6f85e83dcf86a70b45cf7e04">txName</a>-&gt;GetValue()+_(<span class="stringliteral">&quot;&lt;/Login&gt;&quot;</span>);
<a name="l00105"></a>00105                 <span class="keywordtype">char</span> buff[200];
<a name="l00106"></a>00106                 <span class="keywordtype">size_t</span> len = wxConvLibc.FromWChar(buff,200,msg.c_str());
<a name="l00107"></a>00107                 <span class="keywordflow">if</span>(len==wxCONV_FAILED)
<a name="l00108"></a>00108                 {
<a name="l00109"></a>00109                         wxMessageBox(_(<span class="stringliteral">&quot;非法名字!!&quot;</span>));
<a name="l00110"></a>00110                         <a class="code" href="class_connection_dlg.html#a258d3cc15ec391945598f3255346758b">sock</a>-&gt;Destroy();
<a name="l00111"></a>00111                         <span class="keywordflow">return</span>;
<a name="l00112"></a>00112                 }
<a name="l00113"></a>00113                 <a class="code" href="class_connection_dlg.html#a258d3cc15ec391945598f3255346758b">sock</a>-&gt;WriteMsg(buff,len);
<a name="l00114"></a>00114                 len = <a class="code" href="class_connection_dlg.html#a258d3cc15ec391945598f3255346758b">sock</a>-&gt;ReadMsg(buff,200).LastCount();
<a name="l00115"></a>00115                 buff[len] = 0;
<a name="l00116"></a>00116                 wxStringInputStream rev(wxString(buff,wxConvLibc));
<a name="l00117"></a>00117         wxXmlDocument doc(rev);
<a name="l00118"></a>00118                 wxXmlNode *node = doc.GetRoot();
<a name="l00119"></a>00119                 <span class="comment">//wxMessageBox(wxString(buff,wxConvLibc));</span>
<a name="l00120"></a>00120        <span class="comment">// wxMessageBox(node-&gt;GetName()+_(&quot; &quot;)+node-&gt;GetChildren()-&gt;GetContent());</span>
<a name="l00121"></a>00121                 <span class="keywordflow">if</span>(node-&gt;GetName()==_(<span class="stringliteral">&quot;Exit&quot;</span>))
<a name="l00122"></a>00122                 {
<a name="l00123"></a>00123                         wxMessageBox(_(<span class="stringliteral">&quot;用户已连接!!&quot;</span>));
<a name="l00124"></a>00124                         <a class="code" href="class_connection_dlg.html#a258d3cc15ec391945598f3255346758b">sock</a>-&gt;Destroy();
<a name="l00125"></a>00125                 }
<a name="l00126"></a>00126                 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(node-&gt;GetName()==_(<span class="stringliteral">&quot;Login&quot;</span>))
<a name="l00127"></a>00127                 {
<a name="l00128"></a>00128                         <a class="code" href="class_connection_dlg.html#acd5cc8ab241195bf8e5aadbd3d96e61d">serverName</a> = node-&gt;GetChildren()-&gt;GetContent();
<a name="l00129"></a>00129             <span class="comment">//wxMessageBox(_(&quot;机器人：&quot;)+serverName);</span>
<a name="l00130"></a>00130                         <a class="code" href="class_connection_dlg.html#a6d98717981ca03658569ffde8bbdce52">SaveSetting</a>();
<a name="l00131"></a>00131                         EndModal(<a class="code" href="_connection_dlg_8h.html#a1924df58d74539017dc6ac2daaf18dd6">EXIT_LEGAL</a>);
<a name="l00132"></a>00132                 }
<a name="l00133"></a>00133         }
<a name="l00134"></a>00134 }
<a name="l00135"></a><a class="code" href="class_connection_dlg.html#adfe05cd2c81b9b0736872f96fd5bca4c">00135</a> wxString <a class="code" href="class_connection_dlg.html#adfe05cd2c81b9b0736872f96fd5bca4c">ConnectionDlg::GetUserName</a>()
<a name="l00136"></a>00136 {
<a name="l00137"></a>00137         <span class="keywordflow">return</span> <a class="code" href="class_connection_dlg.html#a6ad9689a6f85e83dcf86a70b45cf7e04">txName</a>-&gt;GetValue();
<a name="l00138"></a>00138 }
<a name="l00139"></a><a class="code" href="class_connection_dlg.html#ab831c3b1cf25e61f00f1a0fdad4b4b47">00139</a> wxString <a class="code" href="class_connection_dlg.html#ab831c3b1cf25e61f00f1a0fdad4b4b47">ConnectionDlg::GetServerName</a>()
<a name="l00140"></a>00140 {
<a name="l00141"></a>00141         <span class="keywordflow">return</span> <a class="code" href="class_connection_dlg.html#acd5cc8ab241195bf8e5aadbd3d96e61d">serverName</a>;
<a name="l00142"></a>00142 }
<a name="l00143"></a><a class="code" href="class_connection_dlg.html#a87d30c0aef06fc85f41d93fd60dff6f3">00143</a> <span class="keywordtype">bool</span> <a class="code" href="class_connection_dlg.html#a87d30c0aef06fc85f41d93fd60dff6f3">ConnectionDlg::LoadSetting</a>()
<a name="l00144"></a>00144 {
<a name="l00145"></a>00145         wxTextFile file(_(<span class="stringliteral">&quot;setting&quot;</span>));
<a name="l00146"></a>00146         <span class="keywordflow">if</span>(file.Exists())
<a name="l00147"></a>00147         {
<a name="l00148"></a>00148                 file.Open();
<a name="l00149"></a>00149                 <a class="code" href="class_connection_dlg.html#a6ad9689a6f85e83dcf86a70b45cf7e04">txName</a>-&gt;SetValue(file.GetFirstLine());
<a name="l00150"></a>00150                 <a class="code" href="class_connection_dlg.html#a6135d99604b45174a183df717239d695">txAddr</a>-&gt;SetValue(file.GetNextLine());
<a name="l00151"></a>00151                 <a class="code" href="class_connection_dlg.html#ac2be4dcc2088374d3a6adc59dd702a1d">txPort</a>-&gt;SetValue(file.GetNextLine());
<a name="l00152"></a>00152                 file.Close();
<a name="l00153"></a>00153                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00154"></a>00154         }
<a name="l00155"></a>00155         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00158"></a><a class="code" href="class_connection_dlg.html#a6d98717981ca03658569ffde8bbdce52">00158</a> <span class="keywordtype">void</span> <a class="code" href="class_connection_dlg.html#a6d98717981ca03658569ffde8bbdce52">ConnectionDlg::SaveSetting</a>()
<a name="l00159"></a>00159 {
<a name="l00160"></a>00160         wxTextFile file(_(<span class="stringliteral">&quot;setting&quot;</span>));
<a name="l00161"></a>00161         <span class="keywordflow">if</span>(file.Exists()) file.Open(),file.Clear();
<a name="l00162"></a>00162         <span class="keywordflow">else</span> file.Create();
<a name="l00163"></a>00163         file.AddLine(<a class="code" href="class_connection_dlg.html#a6ad9689a6f85e83dcf86a70b45cf7e04">txName</a>-&gt;GetValue());
<a name="l00164"></a>00164         file.AddLine(<a class="code" href="class_connection_dlg.html#a6135d99604b45174a183df717239d695">txAddr</a>-&gt;GetValue());
<a name="l00165"></a>00165         file.AddLine(<a class="code" href="class_connection_dlg.html#ac2be4dcc2088374d3a6adc59dd702a1d">txPort</a>-&gt;GetValue());
<a name="l00166"></a>00166         file.Write();
<a name="l00167"></a>00167 }
</pre></div></div><!-- contents -->
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>类</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>命名空间</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>枚举</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>枚举值</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>宏定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_connection_dlg_8cpp.html">ConnectionDlg.cpp</a>      </li>

    <li class="footer">Generated at 2012年一月9日 星期一 09:15:28 for RobotClient by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
